package utils.path.support;

import utils.path.ConfigPath;
import utils.test.Assert;

public class WorkDirConfigPath extends ConfigPath {

	
	public WorkDirConfigPath(String locations) {
		super(locations);
	}

	private String getRootPath(){
		String workDir = System.getProperty("user.dir")+"\\";
		return workDir;
	}
	
	@Override
	public String[] processConfigPath() {
		Assert.isNotNull(this.locations, "配置路径不可为空");
		Assert.hasLength(this.locations, "配置路径不可为空");
		String rootPath = getRootPath();
		for (int i=0;i<this.locations.length;i++) {
			locations[i] = rootPath + locations[i];
			locations[i] = locations[i].replaceAll("\\\\", "/");
		}
		return this.locations;
	}

	public static void main(String[] args) {
		WorkDirConfigPath classPath = new WorkDirConfigPath("aaa,bbb");
		String[] locations = classPath.getLocation();
		System.out.println();
	}
}
